﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace EasyLib.Extensions
{
    public static class IntegerExtensions
    {
        public static bool IsInt(this string str)
        {
            int result;
            return int.TryParse(str, out result);
        }

        public static bool ToInt(this string str, out int result)
        {
            bool isInt = IsInt(str);
            result = isInt ? int.Parse(str) : 0;
            return isInt;
        }

        public static int ToInt(this string str)
        {
            return int.Parse(str);
        }
    }
}
